#ifndef __ARPCOMMON_H__
#define __ARPCOMMON_H__

// ----------------------------------------------------------------------------
//
// ARPProtect version 1.0
//
// http://www.snoopspy.com, http://www.netlab.co.kr
//
// Copyright (c) NetworkLab Corporation All rights reserved
//
// ----------------------------------------------------------------------------

#ifdef __BORLANDC__
  #include "map.h"
  #include "string.h"
#else
  #include "map"
  #include "string"
#endif

namespace arp {

	// ----------------------------------------------------------------------------
	// constant
	// ----------------------------------------------------------------------------
	#define MAC_SIZE 6
	#define IP_SIZE  4

	// ----------------------------------------------------------------------------
	// type
	// ----------------------------------------------------------------------------
	typedef unsigned char UINT8, *PUINT8;

	// ----------------------------------------------------------------------------
	// Mac
	// ----------------------------------------------------------------------------
	class Mac
	{
	public:
		UINT8 s[MAC_SIZE];
	public:
		Mac();
		virtual ~Mac();
		void clear();
	public:
		Mac  operator =  (std::string s);
		Mac  operator =  (Mac& mac);
		bool operator == (Mac& mac);
		bool operator != (Mac& mac);
		bool operator <  (Mac& mac);
		bool operator <= (Mac& mac);
		bool operator >  (Mac& mac);
		bool operator >= (Mac& mac);
		std::string toString();
	};

	// ----------------------------------------------------------------------------
	// Ip
	// ----------------------------------------------------------------------------
	class Ip
	{
	public:
		UINT8 s[IP_SIZE];
	public:
		Ip();
		virtual ~Ip();
		void clear();
	public:
		Ip   operator =  (std::string s);
		Ip   operator =  (Ip& ip);
		bool operator == (Ip& ip);
		bool operator != (Ip& ip);
		bool operator <  (Ip& ip);
		bool operator <= (Ip& ip);
		bool operator >  (Ip& ip);
		bool operator >= (Ip& ip);
		std::string toString();
		int  toInt();
	};

	// ----------------------------------------------------------------------------
	// ArpTable
	// ----------------------------------------------------------------------------
	typedef std::map<Ip, Mac> ArpTable;

};

#endif  __ARPCOMMON_H__